
<form id="add-form" class="form-horizontal col-sm-12" role="form" data-toggle="validator" method="POST" action="">
	{:token()}
	<input type="hidden" name="row[id]" value="{$row.id}">

	<div class="col-xs-12 col-sm-6">
		<div class="form-group col-sm-10">
			<label for="c-start_time">工单开始时间:</label>
			<input id="c-start_time"  class="form-control " disabled value="{$row.start_time}"  type="text">
		</div>
	</div>
	<div class="col-xs-12 col-sm-6">
		<div class="form-group col-sm-10">
			<label for="c-end_time">完成工作时间:</label>
			<input id="c-end_time"  class="form-control " disabled value="{$row.end_time}"  type="text">
		</div>
	</div>
	<div class="col-xs-12 col-sm-6">
		<div class="form-group col-sm-10">
			<label>服务费用:<span style="margin-left: 100px">共计<span id="service_money">0</span>元</span></label>
			<dl class="fieldlist">
				<dd>
					<div class="form-inline" style="margin-bottom:20px;display: flex;">
						<input type="hidden" name="row[pay_service][0][field]" value="维修费" />
						<input type="hidden" name="row[pay_service][0][name]" value="维修费" />
						<span>维修费</span>
						<span style="margin-left: 100px"><input type="number"  class="form-control  wx_money"
									 name="row[pay_service][0][money]"
										value="0" style="width: 100px;"/>元</span>

					</div>
				</dd>
			</dl>
		</div>
	</div>

	<div class="col-xs-12 col-sm-12">
		<div class="form-group col-sm-12">
			<dl class="fieldlist" data-name="row[use_parts]" data-template="testtpl">
				<dd>
					<label>配件费用:<span style="margin-left: 100px">共计<span id="parts_money">0</span>元</span></label>
				</dd>
			{foreach name="row.use_parts" item="val" key="k"}
				<dd>
					<input type="hidden" name="row[use_parts][$k][id]" value="{$val.id}">
					<div class="form-inline use_parts" data-price="{$val.price}" style="margin-bottom:20px;display: flex;">
						<span>配件名称：<b>{$val.name}</b></span>
						<span style="margin-left: 20px;">数量：<b>{$val.number}</b></span>
						<span style="margin-left: 20px;">金额：<b>{$val.price}</b></span>
						<span style="margin-left: 20px;">是否收费：<label>
							<input style="width: 30px" class="is_charge" name="row[use_parts][$k][is_charge]" type="radio" checked="checked" value="1"  />是</label>
							<label><input style="width: 30px" class="is_charge" name="row[use_parts][$k][is_charge]" type="radio" value="0"/>否</label></span>
					</div>
				</dd>
			{/foreach}

			</dl>
		</div>
	</div>

	<div class="col-xs-12 col-sm-6">
		<div class="form-group col-sm-10">
			<label>总费用:</label>
			<input data-rule="required" class="form-control" id="total_money" placeholder="总费用" value="0" name="row[total_money]" type="text">
		</div>
	</div>

	<div class="col-xs-12 col-sm-6">
		<div class="form-group col-sm-10">
			<label for="c-contacts">收款账号:</label>
			<input id="c-contacts" data-rule="required" class="form-control selectpage" name="row[collection_account]"
				   data-source="qingdongams/common/getAccount" type="text" value="">
		</div>
	</div>

	<div class="col-xs-12 col-sm-10">
		<div class="form-group col-sm-10">
			<label>收款账号（图）:</label>
			<div class="input-group">
				<input id="c-files" class="form-control" size="50" name="row[collection_img]" type="text" value="">
				<div class="input-group-addon no-border no-padding">
                        <span><button type="button" id="plupload-avatar" class="btn btn-danger plupload"
									  data-input-id="c-files"
									  data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
									  data-multiple="false" data-preview-id="p-collection_img"
									  data-url="qingdongams/base/upload"><i class="fa fa-upload"></i> 上传</button></span>

				</div>
				<span class="msg-box n-right" for="c-files"></span>
			</div>
			<ul class="row list-inline plupload-preview" id="p-collection_img"></ul>
		</div>
	</div>

	<div class="col-xs-12 col-sm-6">
		<div class="form-group col-sm-10">
			<label for="c-contacts">含税方式:</label>
			<label><input style="width: 30px;margin-top: 6px" name="row[tax]"  checked type="radio" value="1"/>
				含<input type="text" class="form-control" name="tax_num" value="13" style="width: 50px">%专用增值税发票</label>
			<label><input style="width: 30px;margin-top: 6px" name="row[tax]" type="radio" value="0"/>不含税</label>
		</div>
	</div>
	<div class="col-xs-12 col-sm-6">
		<div class="form-group col-sm-10">
			<label>审批人:</label>
			<input id="c-owner_staff_id" data-rule="required" data-multiple="true" class="form-control selectpage" name="row[flow_staff_ids]"
				   data-source="qingdongams/common/getStaff" type="text" value="">
		</div>
	</div>

	<div class="form-group layer-footer">
		<label class="control-label col-xs-12 col-sm-2"></label>
		<div class="col-xs-12 col-sm-8">
			<button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
			<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
		</div>
	</div>
</form>
<!--定义模板-->
<script type="text/html" id="testtpl">
	<dd>
		<div class="form-inline" style="margin-bottom:20px;display: flex;">
			<span>配件名称:<input type="text" data-source="qingdongams/common/getParts"
							  class="form-control selectpage" name="row[<%=name%>][<%=index%>][id]"
							  data-field="name" data-primary-key="id" style="width: 200px;"
							  value="<%=row['product_id']%>"/></span>
			<span>数量:<input type="number"  class="form-control  " name="row[<%=name%>][<%=index%>][number]"
							value="<%=row['number']%>" style="width: 100px;"/></span>

			<span style="margin-left: 10px"><span class="btn btn-sm btn-danger btn-remove"><i
					class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i
					class="fa fa-arrows"></i></span></span>
		</div>
	</dd>
</script>
